
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%--使用JSP page指令引入类  *为通配符，表示包下面的所有类--%>
<%@ page import="com.sample.jdbc.*" %>
<%@ page import="com.sample.javabean.*" %>
<%@page import="java.sql.*"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";

%>
<%-- 处理user_add.jsp页面的传值--%>
<%
  //使用request对象的getParameter()方法接收参数值
   request.setCharacterEncoding("utf-8");
   String username=request.getParameter("username");
   String userid=request.getParameter("userid"); 
   String password=request.getParameter("pwd");
   if(username!=null){
     username=new String(username.getBytes(),"gb2312");
   }
   //调用用户模型
    User user=new User(userid,password,username);
   //调用添加用户方法
    user.addUser();

    response.sendRedirect("user_list.jsp");
 %>